﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YXShop.IDAL.Templates;
using YXShop.DALFactory;

namespace YXShop.BLL.Templates
{
    public class FreeLabel
    {
        private readonly IFreeLabel dal = DataAccess.CreateFreeLabel();

        #region Database Operation
        public int Add(YXShop.Model.Templates.FreeLabel model)
        {
            return dal.Add(model);
        }
        public void Update(YXShop.Model.Templates.FreeLabel model)
        {
            dal.Update(model);
        }
        public void Delete(int id)
        {
            dal.Delete(id);
        }
        public void DeleteAll(string ids)
        {
            dal.DeleteAll(ids);
        }
        #endregion
        #region  Data Load
        /// <summary>
        /// 分页
        /// </summary>
        public ChangeHope.DataBase.DataByPage GetListAll()
        {
            return dal.GetListAll();
        }
        /// <summary>
        /// 查所有表名
        /// </summary>
        /// <returns></returns>
        public IList<YXShop.Model.Templates.FreeLabel.FreeLablelDBInfo> GetTables()
        {
            return dal.GetTables();
        }
         /// <summary>
        /// 查表字段类型
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public IList<YXShop.Model.Templates.FreeLabel.FreeLablelDBInfo> GetFields(string tableName)
        {
            return dal.GetFields(tableName);
        }
           /// <summary>
        /// 根据ID查对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public YXShop.Model.Templates.FreeLabel GetSingle(int id)
        {
            return dal.GetSingle(id);
        }
        /// <summary>
        /// 根据条件查集合
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public List<YXShop.Model.Templates.FreeLabel> GetListByWhere(string where)
        {
            return dal.GetListByWhere(where);
        }
        /// <summary>
        /// 分页 根据SQL语句
        /// </summary>
        /// <remarks></remarks>
        public ChangeHope.DataBase.DataByPage GetListAll(string sql, int pagesize)
        {
            return dal.GetListAll(sql,pagesize);
        }
        /// <summary>
        /// 是否存在该标签
        /// </summary>
        /// <param name="Name">标签名</param>
        /// <param name="id">ID</param>
        /// <returns></returns>
        public bool IsRepeat(string name, int id)
        {
            return dal.IsRepeat(name,id);
        }
        #endregion
    }
}
